<!doctype html>
<html>
<head>
    <script src="../dist/purify.js"></script>
</head>
<body>
<!-- Our DIV to receive content -->
<div id="sanitized"></div>

<!-- Now let's sanitize that content -->
<script>
    /* jshint globalstrict:true */
    /* global DOMPurify */
    'use strict';

    // Specify dirty HTML
    var dirty = '<?xml version="1.0" encoding="utf-8"?>\
    <!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->\
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [\
        <!ENTITY ns_svg "http://www.w3.org/2000/svg">\
        <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">\
    ]>\
    <svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="106" height="106" viewBox="0 0 106 106"\
                 overflow="visible" enable-background="new 0 0 106 106" xml:space="preserve">\
    <g>\
        <linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="30.2715" y1="27.1069" x2="77.5955" y2="88.2124">\
            <stop  offset="0" style="stop-color:#A1C1EA"/>\
            <stop  offset="1" style="stop-color:#6295D6"/>\
        </linearGradient>\
        <circle fill="url(#XMLID_4_)" cx="52.78" cy="56.169" r="38.961"/>\
        <radialGradient id="XMLID_5_" cx="52.7808" cy="56.1689" r="38.4507" gradientUnits="userSpaceOnUse">\
            <stop  offset="0" style="stop-color:#82ABE0"/>\
            <stop  offset="1" style="stop-color:#355787"/>\
        </radialGradient>\
        <path fill="url(#XMLID_5_)" stroke="#FFFFFF" stroke-width="0.9531" d="M25.691,28.882c-7.29,7.236-11.324,16.877-11.361,27.148\
            l0,0C14.293,66.3,18.256,75.97,25.492,83.259c7.236,7.288,16.878,11.323,27.148,11.361c10.271,0.036,19.942-3.928,27.229-11.163\
            c7.29-7.236,11.325-16.878,11.362-27.148c0-0.047,0-0.094,0-0.142c0-9.712-3.636-18.98-10.244-26.114\
            c-0.036-0.04-0.077-0.084-0.077-0.084c-7.326-7.86-17.266-12.209-27.989-12.249C42.649,17.683,32.979,21.646,25.691,28.882z\
             M30.976,30.012l1.754-1.284c2.902-2.124,6.107-3.765,9.532-4.879l2.252-0.732l-1.471,1.856c-1.19,1.503-2.31,3.094-3.327,4.73\
            l-0.209,0.339L30.976,30.012z M45.279,30.064l0.855-1.139c1.772-2.362,3.793-4.567,6.003-6.554l0.196-0.177l0.571-0.012\
            l0.557,0.016l0.208,0.179c2.192,2.002,4.198,4.222,5.954,6.598l0.848,1.146L45.279,30.064z M66.245,30.14l-0.208-0.341\
            c-1.005-1.642-2.111-3.241-3.292-4.754l-1.457-1.868l2.247,0.75c3.416,1.138,6.61,2.803,9.496,4.947l1.745,1.297L66.245,30.14z\
             M20.748,44.76l0.38-0.972c1.245-3.176,2.959-6.143,5.097-8.817l0.215-0.269l10.519,0.038l-0.447,1.002\
            c-1.223,2.742-2.205,5.608-2.915,8.518l-0.134,0.547L20.748,44.76z M38.458,44.824l0.255-0.904c0.851-3.027,2.025-5.98,3.491-8.778\
            l0.201-0.384l20.903,0.075l0.199,0.386c1.446,2.809,2.601,5.771,3.428,8.802l0.249,0.906L38.458,44.824z M72.181,44.946\
            l-0.131-0.548c-0.689-2.915-1.65-5.789-2.854-8.54l-0.44-1.005l10.521,0.038l0.212,0.271c2.119,2.69,3.812,5.669,5.033,8.855\
            l0.372,0.974L72.181,44.946z M18.96,59.537l-0.052-0.655c-0.081-1.032-0.118-1.961-0.115-2.836c0.007-1.977,0.196-3.994,0.56-5.998\
            l0.107-0.589l13.142,0.048l-0.094,0.795c-0.228,1.931-0.347,3.879-0.354,5.793l0.081,3.471l-0.733,0.017L18.96,59.537z\
             M67.728,59.715l-30.614-0.11l-0.095-3.491c0.006-1.984,0.145-3.991,0.41-5.968l0.085-0.621l30.583,0.111l0.079,0.622\
            c0.251,1.979,0.377,3.987,0.369,5.969l-0.124,3.511L67.728,59.715z M73.3,59.734l0.105-3.489c0.008-1.915-0.098-3.864-0.312-5.795\
            l-0.088-0.797l13.142,0.049l0.104,0.588c0.35,2.006,0.523,4.025,0.517,6.003c-0.004,0.877-0.049,1.806-0.137,2.834l-0.057,0.655\
            L73.3,59.734z M24.057,74.339l-0.208-0.336c-1.699-2.752-2.994-5.729-3.846-8.853l-0.248-0.905l13.034,0.047l0.102,0.591\
            c0.499,2.903,1.258,5.774,2.256,8.537l0.347,0.962L24.057,74.339z M40.761,74.4l-0.184-0.435c-1.188-2.819-2.094-5.78-2.69-8.8\
            l-0.169-0.856l30.067,0.108l-0.178,0.855c-0.618,3.017-1.545,5.972-2.753,8.78l-0.187,0.434L40.761,74.4z M69.934,74.507\
            l0.354-0.959c1.019-2.755,1.8-5.622,2.319-8.521l0.106-0.59l13.033,0.048l-0.255,0.904c-0.877,3.117-2.193,6.086-3.911,8.823\
            l-0.211,0.337L69.934,74.507z M42.027,88.412c-4.93-1.644-9.491-4.454-13.19-8.127l-1.238-1.229l10.001,0.037l0.2,0.384\
            c1.426,2.749,3.114,5.379,5.018,7.816l1.457,1.868L42.027,88.412z M52.098,90.141l-0.205-0.179\
            c-3.143-2.867-5.866-6.148-8.094-9.754l-0.677-1.095l19.149,0.068l-0.685,1.092c-2.254,3.587-5.001,6.85-8.165,9.694l-0.196,0.178\
            l-0.57,0.012L52.098,90.141z M62.518,87.365c1.92-2.423,3.627-5.04,5.075-7.78l0.2-0.382l10.002,0.036l-1.246,1.22\
            c-3.728,3.646-8.308,6.423-13.25,8.031l-2.252,0.731L62.518,87.365z"/>\
        <g>\
            <g>\
                <path fill="#355787" d="M52.78,17.27c-21.483,0-38.899,17.416-38.899,38.899c0,21.484,17.416,38.9,38.899,38.9\
                    c21.485,0,38.901-17.416,38.901-38.9C91.681,34.686,74.265,17.27,52.78,17.27z M52.78,90.741\
                    c-19.093,0-34.571-15.479-34.571-34.572c0-19.093,15.478-34.571,34.571-34.571c19.094,0,34.573,15.478,34.573,34.571\
                    C87.353,75.263,71.874,90.741,52.78,90.741z"/>\
            </g>\
        </g>\
        <g>\
            <linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="3.9658" y1="86.6484" x2="105.4561" y2="24.3473">\
                <stop  offset="0" style="stop-color:#FAD038"/>\
                <stop  offset="0.0223" style="stop-color:#FACB35"/>\
                <stop  offset="0.188" style="stop-color:#FAAD22"/>\
                <stop  offset="0.3624" style="stop-color:#FA9513"/>\
                <stop  offset="0.547" style="stop-color:#FA8408"/>\
                <stop  offset="0.7487" style="stop-color:#FA7A02"/>\
                <stop  offset="1" style="stop-color:#FA7700"/>\
            </linearGradient>\
            <path fill="url(#XMLID_6_)" d="M82.338,29.095c5.034,1.819,8.295,4.698,9.43,8.327c0.301,0.964,0.451,1.963,0.451,2.994\
                c0,2.059-0.6,4.244-1.797,6.528c-4.637,8.852-17.667,17.707-33.196,22.561c-15.53,4.854-31.284,4.995-40.136,0.358\
                c-3.428-1.796-5.625-4.172-6.528-7.062c-1.135-3.63-0.095-7.852,3.009-12.215l-0.969-0.837C4.916,57.13,1.788,64.73,3.796,71.151\
                c1.178,3.77,3.996,6.845,8.374,9.138c10.9,5.709,29.417,5.585,48.325-0.325c27.098-8.468,45.755-26.201,41.59-39.53\
                c-2.007-6.422-8.905-10.889-19.426-12.578L82.338,29.095z"/>\
            <path fill="#FFF38E" d="M82.761,27.222l-0.642,2.479c4.839,1.748,7.962,4.484,9.034,7.914c0.748,2.396,0.494,5.053-0.756,7.899\
                c-1.261,2.872-3.465,5.8-6.549,8.701c-6.465,6.081-15.988,11.293-26.816,14.677c-7.813,2.442-15.729,3.733-22.891,3.733\
                c-6.073,0-11.413-0.935-15.442-2.7c-3.972-1.742-6.574-4.271-7.525-7.315c-1.072-3.428-0.063-7.457,2.92-11.649l-1.939-1.673\
                C4.284,56.845,1.098,64.679,3.183,71.344c2.691,8.615,13.8,13.758,29.717,13.758c8.714,0,18.322-1.564,27.787-4.523\
                c13.144-4.107,24.741-10.47,32.656-17.915c8.153-7.67,11.476-15.633,9.354-22.42v-0.001\
                C100.615,33.576,93.534,28.952,82.761,27.222L82.761,27.222z M92.858,40.426c0.003-1.091-0.153-2.159-0.477-3.195\
                c-1.238-3.96-4.764-6.911-9.824-8.739l0,0l0,0c9.848,1.581,16.915,5.738,18.914,12.134c0.381,1.22,0.564,2.478,0.562,3.763\
                c-0.026,12.421-17.441,27.373-41.729,34.963c-9.667,3.021-19.099,4.464-27.403,4.464c-14.721,0-25.891-4.537-28.49-12.855\
                c-0.383-1.225-0.567-2.487-0.563-3.776c0.017-5.448,3.381-11.383,9.2-16.969l0,0l0,0c-2.315,3.255-3.583,6.536-3.577,9.631\
                c0.002,1.074,0.158,2.127,0.478,3.147c2.208,7.066,11.69,10.917,24.194,10.917c7.051,0,15.066-1.226,23.275-3.792\
                C78.046,63.673,92.836,50.975,92.858,40.426L92.858,40.426z"/>\
        </g>\
    </g>\
    </svg>';

    // Add a hook to post-process a sanitized SVG
    DOMPurify.addHook('afterSanitizeAttributes', function (node) {
        // Fix namespaces added by Adobe Illustrator
        node.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
        node.setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
    });

    // Clean SVG string and allow the "filter" tag
    var clean = DOMPurify.sanitize(dirty, {ADD_TAGS: ['filter']});

    // Remove partial XML comment left in the HTML
    var badTag  = clean.indexOf(']&gt;');
    var pureSvg = clean.substring(badTag < 0 ? 0 : 5, clean.length);

    // Show sanitized content in <img> element
    var img = new Image();
    img.src = "data:image/svg+xml;base64," + window.btoa(pureSvg);
    document.getElementById('sanitized').appendChild(img);

</script>
</body>
</html>
